<?php
!defined('BASE_PATH') && die('forbidden');


class core_security_input {

	public static function add_s(&$mix){
		if (!is_array($mix)) {
			$mix=addslashes(trim($mix));
		}else {
			foreach ($mix as $k=>$v) {
				self::add_s($mix[$k]);
			}
		}
	}

	public static function no_magic_quotes_sybase(&$mix){
		if (!is_array($mix)) {
			$mix=addslashes(strtr(trim($mix),array("''"=>"'")));
		}else {
			foreach ($mix as $k=>$v) {
				self::no_magic_quotes_sybase($mix[$k]);
			}
		}
	}

	public static function wash_get_post(){

		@set_magic_quotes_runtime(0);
		if (function_exists('get_magic_quotes_gpc')&&get_magic_quotes_gpc()) {
			if (@ini_get('magic_quotes_sybase')) {
				self::no_magic_quotes_sybase($_GET);
				self::no_magic_quotes_sybase($_POST);
				self::no_magic_quotes_sybase($_COOKIE);
			}
		}else {
			self::add_s($_GET);
			self::add_s($_POST);
			self::add_s($_COOKIE);
		}

	}

}


?>